import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './assets/styles/reset.css'
// 富文本编辑器的样式
import './assets/styles/style.css'

// 导入百度echarts
import echarts from 'echarts'

// 引入百度地图
import BaiduMap from 'vue-baidu-map'

Vue.use(BaiduMap,{
  ak:"6NxrfWf7IFoZrzeElrw60wI7W3AwG9sd"
})
// 注册全局组件
import tableTitle from './components/tableTitle.vue'
Vue.component('tableTitle',tableTitle)


// vue的按钮级别权限
Vue.directive('power',{
  bind(){},
  inserted(el,binding){
     if(store.getters.powerCode==0){
        el.style.display="none"
      }
      if(store.getters.powerCode=="1"){
        el.style.display="none"
      }
      if(store.getters.powerCode=="2"){
        el.style.display="block"
      }
  },
  update(){}
});



// 路由拦截器 路由守卫
router.beforeEach((to,from,next)=>{
    console.log(to,"****")
    let arr=to.matched; //多级路由的数据
    console.log(arr,"8￥￥￥￥￥￥￥￥￥￥")
    store.commit("setBread",arr.map(item=>item.meta)) //设置动态路由数据给vuex\
    next();
    
})


Vue.config.productionTip = false
import {Upload,Pagination,Table,TableColumn,Option,Select,Link,Dialog,Breadcrumb,BreadcrumbItem,Menu,MenuItem,MenuItemGroup,Submenu,Col,Row,Form,FormItem,Button,Input,MessageBox,Message,Notification,Loading} from 'element-ui'
Vue.use(Upload)
Vue.use(Pagination)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Select)
Vue.use(Option)
Vue.use(Link)
Vue.use(Dialog)
Vue.use(Breadcrumb)
Vue.use(BreadcrumbItem)
Vue.use(Button)
Vue.use(Input)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Row)
Vue.use(Col)
Vue.use(Menu)
Vue.use(MenuItem)
Vue.use(MenuItemGroup)
Vue.use(Submenu)
// 将element-ui提示插件 挂载到原型
Vue.prototype.$loading = Loading.service;
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification;
Vue.prototype.$message = Message;
// 绑定一个eventBus 的空实例
Vue.prototype.$bus=new Vue({})
Vue.component("",)
//全局挂载echarts插件
Vue.prototype.$echarts=echarts;




new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
